<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLotteryUsersTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('lottery_users', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('lottery_id')->index()->comment('活动ID');
            $table->bigInteger('user_id')->index()->comment('用户ID');
            $table->tinyInteger('level')->comment('用户等级');
            $table->integer('available_times')->comment('可抽奖次数');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('lottery_users');
    }
}
